﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using ExpenseSystem.Core;
using ExpenseSystem.Core.Authority;
using ExpenseSystem.Core.RoleModules;
using ExpenseSystem.Fether;
using ExpenseSystem.Common;
using ExpenseSystem.Lor;
using ExpenseSystem.Model;
using ExpenseSystem.Common.BaseModel;
using ExpenseSystem.Core.Converter;

namespace ExpenseSystem.Controllers
{
    [RoutePrefix("api/RoleCmd")]

    public class RoleCmdController : ApiController
    {
        [Route("List")]
        [HttpGet]
        public ResponseModel List([FromUri]RequestArgs paramModels)
        {
            return SystemControllerHelper.List(new RoleCmdFetcher(), "", null, new GetInhibition());
        }
        public ResponseModel ListByModule([FromUri]long module)
        {
            ResponseModel responseModel = new ResponseModel();
            Authority authority = new Authority();
            RoleCmdFetcher cmdFetcher = new RoleCmdFetcher();
            string message = "";
            int rows;
            IList<RoleCmdModel> roleModel = cmdFetcher.ListByModule(module, out message,out rows);
            responseModel.Count = rows;
            responseModel.Result = Definition.RESP_SUCCESS;
            responseModel.Message = message;
            responseModel.Data = JsonHelper.ArrayToJson(roleModel, new GetInhibition());
            return responseModel;
        }
    }
}
